package com.cjl.dental_clinic.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.cjl.dental_clinic.base.BaseController;
import com.cjl.dental_clinic.base.ResVo;
import com.cjl.dental_clinic.entity.Prescription;
import com.cjl.dental_clinic.service.PrescriptionService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description:
 * @author: cjl
 * @time: 2024/04/13 21:27
 */
@RestController
@RequestMapping("cjl/prescription")
public class PrescriptionController extends BaseController<Prescription, PrescriptionService> {
    public PrescriptionController(PrescriptionService baseService) {
        super(baseService);
    }
    @RequestMapping("addchange")
    private ResVo<Boolean> addChange(Prescription pre){
        if (baseService.exists(new QueryWrapper<Prescription>().eq("id",pre.getId()))) {
            return ResVo.ok(baseService.updateById(pre));
        }
        return ResVo.ok(baseService.save(pre));
    }
}
